package com.pwc.conversitonTool.soapui;

import java.io.IOException;
import java.io.StringReader;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.io.SAXReader;
import org.junit.Assert;
import org.junit.Test;

import com.pwc.conversionTool.config.ConfigBase;

public class XMLProcess {

	String xmlString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
			+ "<config>"
			+ "	<soap>"
			+ "<endpoint>https://wd2-impl-services1.workday.com/ccx/service/pwc_dpt1/Staffing/v25.0?wsdl</endpoint>"
			+ "<username>hyang-impl@pwc_dpt1</username>"
			+ "<password>Underall1@</password>"
			+ "<passwordType>PasswordText</passwordType>"
			+ "</soap>"
			+ "<application>"
			+ "<upload-csv-template>/home/yuanhuang/Desktop/workday/csvTemplate</upload-csv-template>"
			+ "<upload-csv>C:\\Users\\dwu102\\Desktop\\workday\\upload</upload-csv>"
			+ "<mid-relation>/home/yuanhuang/Desktop/workday/relation/</mid-relation>"
			+ "</application>" + "</config>";


	public void TestADD() throws DocumentException, IOException {

		ConfigBase base = new ConfigBase();
		base.readStringToXML(xmlString);
		base.addNodeByXpath ("//application", "qwe", "asd");	
		System.out.println(base.toString());

	}
	@Test
	public void TestDelete() throws DocumentException {
		ConfigBase base = new ConfigBase();
		base.readStringToXML(xmlString);
		base.addNodeByXpath ("//application", "qwe", "asd");	
		System.out.println(base.toString());
		base.deleteNodeByXpath("//application/qwe");
		System.out.println(base.toString());
	}

}
